/*
 * ClientManager.cpp
 *
 *  Created on: 26 sept. 2009
 *      Author: CHETIER
 */

#include "ClientManager.h"

ClientManager::ClientManager(){}

ClientManager::~ClientManager(){}

bool ClientManager::Contains(ClientInfo clientInfo)
{
	for ( std::list<ClientInfo>::iterator i = this->begin(); i != this->end() ; ++i)
		if(i->id == clientInfo.id)
			return true;

	return false;
}

ClientInfo& ClientManager::operator [](UINT32 index)
{
	std::list<ClientInfo>::iterator indexIterator = this->begin();
	UINT32 currentIndex = 0;
	while(currentIndex != index) indexIterator++, currentIndex ++;
	return *indexIterator;
}

int ClientManager::IndexOf(ClientInfo clientInfo)
{
	for ( UINT32 i = 0; i < this->size() ; i++ )
		if( (*this)[i].id == clientInfo.id)
			return i;

	return -1;
}




